package br.enovar.com.dois;

import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	
	private static Logger logger = Logger.getLogger(HibernateUtil.class);
	private static SessionFactory factory;
	
	static{
		Configuration configuration = new Configuration();
		configuration.configure();
		
		factory = configuration.buildSessionFactory();
	}
	
	public static Session openSession(){
		logger.info("opening new session");
		return factory.openSession();
	}
}
